Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LizandroCanul/back_sdo/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Ejercicio Fiscal (fiscal year) defines the budget year for public works projects. This catalog maintains the list of fiscal years that can be associated with projects.

Get All Fiscal Years

Retrieves a list of all fiscal years in the system.

Authentication

This endpoint requires authentication using a Bearer token.

Response

id
number
required
Unique identifier for the fiscal year
anio
number
required
The fiscal year (e.g., 2025, must be unique)
activo
boolean
required
Status flag indicating if the fiscal year is active (default: true)

Example Request

curl --request GET \
  --url http://localhost:3000/ejercicio-fiscal \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

[
  {
    "id": 1,
    "anio": 2024,
    "activo": true
  },
  {
    "id": 2,
    "anio": 2025,
    "activo": true
  },
  {
    "id": 3,
    "anio": 2026,
    "activo": false
  }
]

Get Active Fiscal Years

Retrieves a list of only active fiscal years in the system.

Authentication

This endpoint requires authentication using a Bearer token.

Response

Returns an array of fiscal year objects where activo is true.
id
number
required
Unique identifier for the fiscal year
anio
number
required
The fiscal year
activo
boolean
required
Always true for this endpoint

Example Request

curl --request GET \
  --url http://localhost:3000/ejercicio-fiscal/activos \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

[
  {
    "id": 1,
    "anio": 2024,
    "activo": true
  },
  {
    "id": 2,
    "anio": 2025,
    "activo": true
  }
]

Get Fiscal Year by ID

Retrieves a single fiscal year by its unique identifier.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the fiscal year to retrieve

Response

Returns a single fiscal year object with the following fields:
id
number
required
Unique identifier for the fiscal year
anio
number
required
The fiscal year
activo
boolean
required
Status flag indicating if the fiscal year is active

Example Request

curl --request GET \
  --url http://localhost:3000/ejercicio-fiscal/2 \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

{
  "id": 2,
  "anio": 2025,
  "activo": true
}

Error Responses

statusCode
number
HTTP status code (404 if fiscal year not found)
message
string
Error message describing what went wrong
{
  "statusCode": 404,
  "message": "Fiscal year not found"
}

Create Fiscal Year

Creates a new fiscal year in the system.

Authentication

This endpoint requires authentication using a Bearer token.

Request Body

anio
number
required
The fiscal year (must be unique, between 2000 and 2100)
activo
boolean
Status flag (defaults to true if not provided)

Validation Rules

  • anio is required and must be a number
  • anio must be between 2000 and 2100
  • anio must be unique across all fiscal years
  • activo is optional and defaults to true

Example Request

curl --request POST \
  --url http://localhost:3000/ejercicio-fiscal \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "anio": 2027,
    "activo": true
  }'

Example Response

{
  "id": 4,
  "anio": 2027,
  "activo": true
}

Error Response

{
  "statusCode": 400,
  "message": [
    "anio should not be empty",
    "anio must be a number conforming to the specified constraints",
    "anio must not be less than 2000",
    "anio must not be greater than 2100"
  ],
  "error": "Bad Request"
}

Update Fiscal Year

Updates an existing fiscal year.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the fiscal year to update

Request Body

All fields are optional. Only include fields you want to update.
anio
number
The fiscal year (must be unique if provided, between 2000 and 2100)
activo
boolean
Status flag

Example Request

curl --request PATCH \
  --url http://localhost:3000/ejercicio-fiscal/3 \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "activo": true
  }'

Example Response

{
  "id": 3,
  "anio": 2026,
  "activo": true
}

Delete Fiscal Year

Deletes a fiscal year from the system.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the fiscal year to delete
Deleting a fiscal year that is referenced by existing projects may fail due to foreign key constraints. Consider setting activo to false instead.

Example Request

curl --request DELETE \
  --url http://localhost:3000/ejercicio-fiscal/4 \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

{
  "message": "Fiscal year deleted successfully"
}